import Vue from 'vue'
import request from '@/itsoftUI/utils/request'
import qs from "qs"
const baseUrl = Vue.prototype.$itsoftUI.config.serviceUrl + "/repair"

//录单api
export const catalogueApi = {
    //获取当前用户待办数据
    GetMyToDo: function () {
        return request({
            url: baseUrl + '/publish/getMyToDo',
            method: 'post',
            data: qs.stringify()
        })
    },
    GetProjectByAreaId: function (areaId) {
        const data = {
            areaId
        }
        return request({
            url: baseUrl + '/publish/getProjectByAreaId',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    // 3根据区域项目筛选受理单位受理人
    GetAcceptUserByAreaIdAndProjectId: function (areaId, projectId) {
        const data = {
            areaId,
            projectId
        }
        return request({
            url: baseUrl + '/publish/getAcceptUserByAreaIdAndProjectId',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    // 获取审批人列表(申请大维修时专用)
    GetUserByAreaIdAndProjectId: function (areaId, projectId) {
        const data = {
            areaId,
            projectId
        }
        return request({
            url: baseUrl + '/publish/getUserByAreaIdAndProjectId',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    //获取预约日期
    GetBookDate: function () {
        return request({
            url: baseUrl + '/publish/getBookDate',
            method: 'post',
            data: qs.stringify()
        })
    },

    //   1获取服务范围级联结
    GetAreaTree: function () {
        return request({
            url: baseUrl + '/publish/getAreaTree',
            method: 'post',
            data: qs.stringify()
        })
    },
    //获取预约时间
    GetBookTime: function (bookDate) {
        const data = {
            bookDate
        }
        return request({
            url: baseUrl + '/publish/getBookTime',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    Save: function (data) {
        const config = {
            headers: {
                'Content-Type': 'application/json;charset=utf-8'
            },
        }
        return request.post(baseUrl + "/publish/publish", data, config)
    }
}